package psn.kiko.config.redis;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.Set;

/**
 * 清理Redis缓存
 */
@Slf4j
@Getter
@Setter
public class CleanRedisCache{
	private RedisTemplate redisTemplate;
	
	public void cleanCache(){
		log.debug("即将清空Redis缓存...");
		Set keys=redisTemplate.keys("*");
		log.debug("Redis缓存数据：{}",keys);
		if(!keys.isEmpty()){
			redisTemplate.delete(keys);
		}
	}
}
